/**
 * Created by kaki on 2017/9/18.
 */
import fetch from '@/utils/fetch'

export const GetTable = (page, per_page = 10, keyword, is_publish) => {
  const params1 = {
    page,
    per_page,
    keyword,
    is_publish
  }

  const params2 = {
    page,
    per_page,
    keyword
  }

  return fetch({
    url: '/api/staff/cards/types',
    method: 'get',
    params: is_publish === '2' ? params2 : params1
  })
}

export const Delete = (id) => {
  return fetch({
    url: `/api/staff/cards/types/${id}`,
    method: 'delete'
  })
}

export const Show = (id) => {
  return fetch({
    url: `/api/staff/cards/types/${id}`,
    method: 'get'
  })
}

export const Update = (id, data) => {
  return fetch({
    url: `/api/staff/cards/types/${id}`,
    method: 'put',
    data
  })
}

export const Publish = (id) => {
  return fetch({
    url: `/api/staff/cards/types/${id}/publish`,
    method: 'post'
  })
}
export const Create = (data) => {
  return fetch({
    url: `/api/staff/cards/types`,
    method: 'post',
    data
  })
}
export const Edit = (page, per_page = 10, keyword) => {
  return fetch({
    url: '/api/staff/files',
    method: 'get',
    data: {
      page,
      per_page,
      keyword
    }
  })
}
export const EditShow = (id) => {
  return fetch({
    url: `/api/staff/files/${id}`,
    method: 'get'
  })
}

